package org.ly817.my.spring.core.ioc.bean;

/**
 * bean定义信息
 * beanFactory生产bean的工单
 */
public class BeanDefinition {

    private Object bean;

    /**
     * 用于反射获取bean对象
     */
    private Class beanClass;

    /**
     * 类路径 用于加载beanClass
     */
    private String beanClassName;
    // 不直接接受new出来的对象，而是通过类路径 利用反射机制创建对象
//    public BeanDefinition(Object bean) {
//        this.bean = bean;
//    }

    /**
     * bean注入属性信息
     */
    private PropertyValues beanPropertyValues = new PropertyValues();

    public Object getBean() {
        return bean;
    }

    public void setBean(Object bean) {
        this.bean = bean;
    }

    public Class getBeanClass() {
        return beanClass;
    }

    public String getBeanClassName() {
        return beanClassName;
    }

    public void setBeanClassName(String beanClassName) {
        this.beanClassName = beanClassName;
        try {
            this.beanClass = Class.forName(beanClassName);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    public PropertyValues getBeanPropertyValues() {
        return beanPropertyValues;
    }

    public void setBeanPropertyValues(PropertyValues beanPropertyValues) {
        this.beanPropertyValues = beanPropertyValues;
    }
}
